<template>
	<view>
		<scroll ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" :up="upOption" @up="upCallback"
		 @emptyclick="emptyClick">
			<stop isBack>
				<view slot="content">活动审核</view>
			</stop>
		
			<view class="">
				<view class="pad3 bdbdo pos-r mart3 bcf" 
				v-for="row in data">
					<view class="flrc fwb fs12">
						<status :item="row.type" classes="round3"></status>
						<view class="padl2 flex1">{{row.name}}</view>
					</view>
					<view class="flrc padb2 mart3">
						<view>开始时间：</view>
						<view class="flex1 tar">{{datetime(row.startAt)}}</view>
					</view>
					<view class="flrc padb2">
						<view>结束时间：</view>
						<view class="flex1 tar">{{datetime(row.endAt)}}</view>
					</view>
					<view class="flrc padb2">
						<view>活动地点：</view>
						<view class="flex1 tar">{{row.address}}</view>
					</view>
					<view class="flrc padb2">
						<view>预估时间：</view>
						<view class="flex1 tar">{{row.time}}</view>
					</view>
					<view class="flrc padb2">
						<view>预估费用：</view>
						<view class="flex1 tar">{{row.money}}</view>
					</view>
					<view class="padt2">
						<view class="list-style-2">活动内容</view>
						<view class="mart3" v-html="row.intro"></view>
					</view>
					<!-- {{row}} -->
					<view class="flrc" v-if="!isbool(row.checkAt)">
						<view class="cu-btn mar2 line-green" @tap="confirmIt(row.id)">确认审核</view>
						<view class="cu-btn mar2 line-red" @tap="deleteIt(row.id)">删除</view>
					</view>
				</view>
			</view>
			<loading :loading="myIsLoading"></loading>
		</scroll>
	</view>
</template>

<script>
	import List from '../../../assets/js/list.js'
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins:[MescrollMixin],
		data() {
			let list = new List()
			return {
				list,
				data:[]
			}
		},
		methods: {
				reload() {
					this.showLoading()
					this.list.setData({
						_order: {
							id: "DESC"
						},
						_g:['activity'],
						_range:{"0":'my'}
					}).reload()
				},
				confirmIt(id){
					this.showLoading()
					this.$api.get('/api/cimingActivitys/' + id +'/check',{},res=>{
						this.reload()
					})
				},
				deleteIt(id){
					this.$api.delete('/api/cimingActivitys/' + id ,{},res=>{
						this.reload()
					})
				}
		},
		mounted() {
			this.list.initMescroll(this).setUrl('/api/cimingActivitys').setData({
				_order: {
					id: "DESC"
				},
				_g:['activity'],
				_range:{"0":'my'}
			}).setCbFunc(res => {
				this.data = res
				this.clearLoading()
			}).reload()
		},
		onLoad(option) {
			
		},
		onShow() {
			this.reload()
		}
	}
</script>

<style>

</style>
